using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using System.Collections;
using System.Runtime.InteropServices;
using System.ComponentModel;

namespace WindowsGame
{
    /// <summary>
    /// Creates a new static map object.
    /// </summary>
    public class StaticMapObject : MapObject
    {
        #region Private fields

        /// <summary>
        /// Holds the texture of this object
        /// </summary>
        private Texture2D mTexture;

        /// <summary>
        /// Holds the bounds of this object
        /// </summary>
        private TileRect mBounds;

        #endregion

        #region Public properties

        /// <summary>
        /// Gets and sets the texture of this object
        /// </summary>
        public Texture2D Texture
        {
            get
            {
                return this.mTexture;
            }
            set
            {
                if (this.mTexture != value)
                {
                    this.mTexture = value;
                }
            }
        }

        /// <summary>
        /// Gets and sets the bounds of this object
        /// </summary>
        public override TileRect Bounds
        {
            get
            {
                return this.mBounds;
            }
            set
            {
                if (this.mBounds != value)
                {
                    this.mBounds = value;
                }
            }
        }

        #endregion

        #region Public methods

        /// <summary>
        /// Draws the texture on the given position.
        /// </summary>
        /// <param name="batch">SpriteBatch object which uses this draw method to perform the drawing itself.</param>
        public override void Draw(SpriteBatch batch)
        {
            batch.Draw(this.mTexture, new Vector2(this.mBounds.X + Global.Offset.X, this.mBounds.Y + Global.Offset.Y), Color.White);
        }

        /// <summary>
        /// Draws the texture on the given position.
        /// </summary>
        /// <param name="batch">SpriteBatch object which uses this draw method to perform the drawing itself.</param>
        /// <param name="alphaColor">Color to use for alpha blending.</param>
        public override void Draw(SpriteBatch batch, Color alphaColor)
        {
            batch.Draw(this.mTexture, new Vector2(this.mBounds.X + Global.Offset.X, this.mBounds.Y + Global.Offset.Y), alphaColor);
        }

        #endregion

        #region Constructor / Destructor

        /// <summary>
        /// Creates a new static map object.
        /// </summary>
        public StaticMapObject()
        {
            this.mTexture = null;
        }

        /// <summary>
        /// Creates a new static map object.
        /// </summary>
        /// <param name="texture">Texture to draw.</param>
        public StaticMapObject(Texture2D texture)
        {
            this.mTexture = texture;
        }

        #endregion
    }
}
